package com.weic;

import com.weic.listener.MyListener;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;

import javax.servlet.http.HttpSessionListener;

@MapperScan("com.weic.mapper")
@SpringBootApplication
@ServletComponentScan
public class SpringBoot02Application {
    public static void main(String[] args) {
        SpringApplication.run(SpringBoot02Application.class,args);
    }

    @Bean
    public ServletListenerRegistrationBean<HttpSessionListener> getServletListenerRegistrationBean(){
        ServletListenerRegistrationBean<HttpSessionListener> bean = new ServletListenerRegistrationBean<HttpSessionListener>(new MyListener());
        bean.setOrder(1);
        System.out.println("myListener registor");
        return bean;
    }
}
